#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0;
        int right = height.size() - 1;
        int _max = min(height[left], height[right]) * (right - left);
        while (left < right)
        {
            int v = min(height[left], height[right]) * (right - left);
            if (height[left] < height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
            _max = max(v, _max);
        }
        return _max;
    }
};